$(function() {
    var coverContent =
        "<div class='network' id='senseDemo'>" +
        "<div><h6>类别：</h6><p>供水管网</p></div>" +
        "<div><h6>名称：</h6><p>湖边补调管道</p></div>" +
        "<div><h6>编号：</h6><p>J0010</p></div>" +
        "<div><h6>年份：</h6><p>2016/2/2</p></div>" +
        "<div><h6>规格：</h6><p>700mm</p></div>" +
        "<div><h6>埋深：</h6><p>700mm</p></div>" +
        "<div><h6>高程：</h6><p>5000mm</p></div>" +
        "<div><h6>壁厚：</h6><p>50mm</p></div>" +
        "<div><h6>寿命：</h6><p>20年</p></div>" +
        "<div><h6>材质：</h6><p>铸造</p></div>" +
        "<div><h6>责任：</h6><p>林海洋</p></div>" +
        "<div><h6>部门：</h6><p>湖边所检修班</p></div>" +
        "<div><h6>备注：</h6><p>井内有积水</p></div>" +
        "</div>" +
        "</div>";
    var map = new BMap.Map("map"); // 百度地图API定位一个厦门大位置功能
    var point = new BMap.Point(118.10388605, 24.48923061);
    var coverWindow = new BMap.InfoWindow(coverContent); // 创建信息窗口对象
    map.centerAndZoom(point, 15);
    map.enableScrollWheelZoom();
 
    //创建井盖小图标
    var pt = new BMap.Point(118.10388605, 24.48);
    var myIcon = new BMap.Icon("images/build.png", new BMap.Size(500, 157));
    var marker4 = new BMap.Marker(pt, { icon: myIcon }); // 创建标注
    map.addOverlay(marker4);
    marker4.addEventListener("click", function() {
        this.openInfoWindow(coverWindow);
        //图片加载完毕重绘infowindow
        document.getElementById('coverDemo').onload = function() {
            coverWindow.redraw(); //防止在网速较慢，图片未加载时，生成的信息框高度比图片的总高度小，导致图片部分被隐藏
        }
    });
    var polyline = new BMap.Polyline([
        new BMap.Point(118.10388605, 24.47),
        new BMap.Point(118.10388605, 24.48923061),
        
    ], {strokeColor:"blue", strokeWeight:2, strokeOpacity:0.5});   //创建折线
    map.addOverlay(polyline);   //增加折线

})
